$(function () {
  // 粒子背景
  $('#particles').particleground({
    dotColor: '#7ec7fd',
    lineColor: '#7ec7fd'
  });
  // alert(1)
  $('#form_login').on('submit', function (e) {
    e.preventDefault()
    let userinfo = $(this).serialize()
    $.post('/api/login', userinfo, (res) => {
      if (res.status !== 0) {
        return layui.layer.msg(res.message, {
          icon: 5
        })
      }
      localStorage.setItem('token', res.token)
      layui.layer.msg(res.message, {
        icon: 6
      }, function () {
        location.href = './index.html'
      })
    })
  })
})